Skip to content

Integrate Intercom SDK for helpdesk functionality #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Ayyanaruto
Copy link
Contributor

@Ayyanaruto Ayyanaruto commented Jul 5, 2025

2025-07-16.18-59-40.mp4

Integrate the Intercom SDK to enhance helpdesk prefill functionality, replacing the previous Freshworks integration with the new messaging feature.

Summary by CodeRabbit

  • New Features
    • Replaced the previous Freshworks support widget with Intercom, enabling in-app messaging for user support and error reporting.
  • Chores
    • Added the Intercom messenger SDK to project dependencies.

Copy link
Contributor

coderabbitai bot commented Jul 5, 2025

Walkthrough

Replaced Freshworks support widget with the Intercom Messenger SDK: added the dependency, initialized Intercom in AppHead, and removed Freshworks prefill code and exported hook from SomethingWentWrong. No other public APIs were added.

Changes

Cohort / File(s) Change Summary
Dependency
web-server/package.json
Added @intercom/messenger-js-sdk dependency (^0.0.14).
App head / initialization
web-server/src/components/AppHead.tsx
Removed Freshworks script and styles; imported and initialized Intercom Messenger SDK inside a useEffect.
Error UI / helpdesk integration
web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx
Removed Freshworks prefill helper and exported useHelpdeskPrefill; calls to Freshworks removed.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant AppHead
    participant Intercom

    Browser->>AppHead: Load app
    AppHead->>Intercom: initialize(appId)
    Note right of Intercom: Intercom messenger loaded

    Browser->>SomethingWentWrong: Error occurs
    SomethingWentWrong->>Intercom: showNewMessage(error details)
    Intercom->>Browser: Open messenger with message
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
Out with the old, in with the new,
Intercom hops in to say hello.
Errors now whisper into a thread,
A little hop, a helpful glow.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 984a82f and daff0a5.

📒 Files selected for processing (1)
  • web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
web-server/src/components/AppHead.tsx (1)

13-32: Potential issue: Intercom may initialize multiple times.

The Intercom initialization is inside a useEffect with dependencies that may cause it to re-run when the router changes. This could lead to multiple initializations of the Intercom widget.

Consider moving the Intercom initialization to a separate useEffect with an empty dependency array:

  useEffect(() => {
    const isDev = process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'development';
-    Intercom({
-      app_id: 'kckm1m2e'
-    });
+  }, [router.asPath, router.events, router.isReady, router.pathname]);
+
+  useEffect(() => {
+    Intercom({
+      app_id: process.env.NEXT_PUBLIC_INTERCOM_APP_ID || 'kckm1m2e'
+    });
+  }, []);
+
+  useEffect(() => {
+    const isDev = process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'development';
    if (!isDev) {
      const onFocus = () => track('WINDOW_FOCUS');
      const onBlur = () => track('WINDOW_BLUR');
      const onUnload = () => track('WINDOW_UNLOAD');

      window.addEventListener('focus', onFocus);
      window.addEventListener('blur', onBlur);
      window.addEventListener('beforeunload', onUnload);
      return () => {
        window.removeEventListener('focus', onFocus);
        window.removeEventListener('blur', onBlur);
        window.removeEventListener('beforeunload', onUnload);
      };
    }
  }, [router.asPath, router.events, router.isReady, router.pathname]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bafb28c and ec897c7.

⛔ Files ignored due to path filters (1)
  • web-server/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • web-server/package.json (1 hunks)
  • web-server/src/components/AppHead.tsx (2 hunks)
  • web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: All file linting
🔇 Additional comments (2)
web-server/package.json (1)

18-18: Confirm @intercom/messenger-js-sdk version and beta status

The dependency in web-server/package.json (line 18):

"@intercom/messenger-js-sdk": "^0.0.14",

is indeed the latest published release—but it’s still classified as a beta (0.0.x) with no non-beta version available.

Before proceeding, please ensure you’re comfortable with the implications of a beta SDK:

  • Pin the dependency to an exact version (e.g. "0.0.14") if you need to avoid unintended minor bumps.
  • Add integration or end-to-end tests around any Intercom interactions to catch breaking changes early.
  • Monitor the package’s changelog or GitHub issues for upcoming API changes or security advisories.
web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx (1)

1-1: Good implementation approach for replacing Freshworks with Intercom.

The import and usage of showNewMessage aligns well with the overall migration strategy.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Ayyanaruto
❌ Ayyan-ai
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants